// ======================================================================
// Copyright (C) 2013 Hell-Prototypes. / www.hellprototypes.com
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// ======================================================================
#ifndef CTRL_FEED_ZONE_H
#define CTRL_FEED_ZONE_H

#include "define.h"
#include <QWidget>
#include <QPushButton>
#include <QLayout>
#include <QComboBox>

class ctrl_feed_zone : public QWidget
{
    Q_OBJECT
public:
    explicit ctrl_feed_zone(int id = -1, QWidget *parent = 0);

    void set_value_list(const QStringList &list);
    void set_value_index(int index);

    void   set_feeder_zone_position(iPoint &pos);
    iPoint get_feeder_zone_position();

    void  set_feeder_zone_size(QSize &size);
    QSize get_feeder_zone_size();

    QString get_selected_value();
    int get_selected_index();

    void set_feeder_part_area(int area) { m_part_area = area;   }
    int  get_feeder_part_area()         { return m_part_area;   }

signals:
    void feeder_zone_set_position(int id);
    void feeder_zone_delete(int id);
    void feeder_move_arm_to_zone(int id);

public slots:
    void on_pb_set_zone_position_clicked();
    void on_pb_zone_delete_clicked();
    void on_pb_move_arm_to_zone_clicked();
    void on_value_list_IndexChanged(int index);

protected:
    int m_id;

    iPoint m_feeder_position;
    QSize  m_feeder_size;
    double m_part_area;

    QHBoxLayout *m_layout;

    QPushButton *m_set_zone_position;
    QComboBox * m_zone_value_list;
    QPushButton *m_zone_delete;
    QPushButton *m_move_arm_to_zone;

    int m_last_select_value;

};

#endif // CTRL_FEED_ZONE_H
